home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- *
- * Sample.h -- constants for the Sample code and resources
- *
- * Developer Support Center
- * Apple Computer, Inc.
- * Copyright 1988-1993, Apple Computer, Inc. All rights reserved.
- *
- * This FILE contains constant definitions for the Sample code, including
- * dialog IDs, resource IDs and the like.
- *
- ******************************************************************************/
-
- /* These #defines correspond to values defined in the Pascal source code.
- Sample.c and Sample.r include this FILE. */
-
- /* The minimum partition an application requests from the system depends
- on many things. What kind of work does this application do? What
- environment do you think is reasonable for users of the application?
- what is “reasonable functionality?” What about performance? And so
- on. Here are some things to consider when determining the minimum
- size (and preferred size) for your application. This list is pretty
- much in order of importance, but by no means complete.
-
- 1. What is the minimum size needed to give almost 100 percent
- assurance that the application won't crash because it ran out of
- memory? This includes not only things that you do have direct control
- over such as checking for NIL handles and pointers, but also things
- that some feel are not so much under their control such as QuickDraw,
- the Segment Loader, the Edition Manager, Apple Events and so on.
-
- 2. What kind of performance can a user expect from the application
- when it is running in the minimum memory configuration? Performance
- includes not only speed in handling data, but also things like how
- many documents can be opened, etc.
-
- 3. What are the typical sizes of scraps that a user might wish to work
- with when launching or switching to your application? If there’s not
- enough memory, the scrap may be lost. This doesn’t make users happy.
-
- 4. While the above thoughts may make you want to increase your minimum
- requested size, you should also consider what environments actual
- real people will have when trying to use your application. A lot of
- users with relatively small memory configurations may want to use
- your application. Or, many users might want to use it while several
- other, possibly related/complementary applications are running. If
- that is the case, it would be helpful to have a fairly small minimum
- size.
-
- So what did we do for Sample 3.0? Sample can easily run out of memory if
- you open too many documents, but it checks before opening a new one
- to make sure that there's enough memory to proceed. These partitions
- allow you to open a dozen and a half windows or more and still be
- able to watch what's going on in your heap with a debugger or other
- memory utility. For sample code, that's probably a good goal.
-
- This heap size gives Sample lots of room, even with all the segments
- loaded. */
-
- #define kMinSize 180 /* application's minimum size (in K) */
-
- /* We made the preferred size bigger than the minimum size by 20K, so that
- there would be even more room for the scrap, windows, etc. */
-
- #define kPrefSize 200 /* application's preferred size (in K) */
-
- #define rMenuBar 128 /* application's menu bar */
- #define rAboutAlert 128 /* about Alert */
-
- #define rFeaturesNotPresent 1000 /* Alert "some required features are missing" */
- #define rNoMemoryForApp 1001 /* Alert "Not enough memory to run" */
-
- /* The following constants are used to identify menus and their items. The menu IDs
- have an "m" prefix and the item numbers within each menu have an "i" prefix. */
-
- #define mApple 128 /* Apple menu */
- #define iAbout 1
-
- #define mFile 129 /* FILE menu */
- #define iNew 1
- #define iOpen 2
- #define iClose 4
- #define iSave 5
- #define iSaveAs 6
- #define iRevert 7
- #define iPageSetup 9
- #define iPrint 10
- #define iQuit 12
-
- #define mEdit 130 /* Edit menu */
- #define iUndo 1
- #define iCut 3
- #define iCopy 4
- #define iPaste 5
- #define iClear 6
- #define iPrefs 8
-
- /* Other menus are defined in the header files for code that uses them */
-
- /* These are for positioning the Disk Initialization dialogs. */
-
- #define kDITop 0x0050
- #define kDILeft 0x0070
-
- /* kNoEvents is the inverse of "every event" -- it means we don't want any
- events. We use this with WaitNextEvent to let the toolbox fill in the
- mouse position and tick count without extracting any events from the
- event queue. */
-
- #define kNoEvents 0
-
- /* kMinHeap is the minimum result from the following equation:
-
- ORD(GetApplLimit) - ORD(ApplicZone)
-
- for the application to run. It will insure that enough memory will
- be around for reasonable-sized scraps, FKEYs, etc. to exist with the
- application, and still give the application some 'breathing room'.
- To derive this number, we ran under a MultiFinder partition that was
- our requested minimum size, as given in the 'SIZE' resource. */
-
- #define kMinHeap 60 * 1024
-
- /* kMinSpace is the minimum result from PurgeSpace, when called at
- initialization time, for the application to run. This number acts
- as a double-check to insure that there really is enough memory for the
- application to run, including what has been taken up already by
- pre-loaded resources, the scrap, code, and other sundry memory blocks. */
-
- #define kMinSpace 24 * 1024
-
- /* kExtremeNeg and kExtremePos are used to set up wide open rectangles and regions. */
-
- #define kExtremeNeg -32768
- #define kExtremePos 32767 - 1 /* required to address an old Region bug */
-
- /* these #defines are used to set enable/disable flags of a menu */
-
- #define AllItems 0b1111111111111111111111111111111 /* 31 flags */
- #define NoItems 0b0000000000000000000000000000000
- #define MenuItem1 0b0000000000000000000000000000001
- #define MenuItem2 0b0000000000000000000000000000010
- #define MenuItem3 0b0000000000000000000000000000100
- #define MenuItem4 0b0000000000000000000000000001000
- #define MenuItem5 0b0000000000000000000000000010000
- #define MenuItem6 0b0000000000000000000000000100000
- #define MenuItem7 0b0000000000000000000000001000000
- #define MenuItem8 0b0000000000000000000000010000000
- #define MenuItem9 0b0000000000000000000000100000000
- #define MenuItem10 0b0000000000000000000001000000000
- #define MenuItem11 0b0000000000000000000010000000000
- #define MenuItem12 0b0000000000000000000100000000000
-